const express = require('express');
const router = express.Router();
const { Setting } = require('../models');
const { failure, success } = require('../utils/responses');
const { NotFoundError } = require('../utils/errors');

//系统信息
router.get('/', async (req, res) => {
    try {
        const setting = await Setting.findOne();
        if (!setting) {
            throw new NotFoundError('系统信息不存在');
        }

        success(res, '查询系统信息成功', { setting });
    } catch (error) {
        failure(res, error);
    }
})

module.exports = router;